﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class cn_about : System.Web.UI.Page
{
    protected string _cid ="";
    private string parentId = "", mode = "", _Id = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        _Id = Request.QueryString["Id"];
        _cid = Request.QueryString["cid"];
        parentId = Request.QueryString["parentId"];
        if (string.IsNullOrEmpty(_Id))
        {
            Response.Redirect("Default.aspx");
        }
        else
        {
            if (!Whir.Common.WebHelper.Utils.IsInt(_Id))
            {
                Response.Redirect("Default.aspx");
            }

        }
        if (!string.IsNullOrEmpty(Request.QueryString["tagret"]))
            p2.Visible = false;

        Control ctr = null;
         mode = Request.QueryString["mode"];
        switch (mode)
        {
            case "baiy": ctr = this.LoadControl("common/menu_baiy.ascx"); break;
            case "about": ctr = this.LoadControl("common/menu_about.ascx"); break;
            case "ztactive": ctr = this.LoadControl("common/menu_ztactive.ascx"); break;
            case "jnews": ctr = this.LoadControl("common/menu_jnews.ascx"); break;
            case "pxnews": ctr = this.LoadControl("common/menu_pxnews.ascx"); break;
            case "kfu": ctr = this.LoadControl("common/menu_kfu.ascx"); break;
            case "kgarden": ctr = this.LoadControl("common/menu_kgarden.ascx"); break;
            case "index": ctr = this.LoadControl("common/menu_index.ascx"); break;
            case "user": ctr = this.LoadControl("common/menu-index.ascx");
                menu_file1.Visible = false;
                break;
            default: ctr = this.LoadControl("common/menu_news.ascx"); break;
        }

        panne1.Controls.Add(ctr);
        if (!IsPostBack)
        {
            GetTipsInfo();
            GetNewsInfo();
        }

    }

    private void GetTipsInfo()
    {

        ltrTips.Text = ColumnHelp.GetColumnName(_cid);
      
    }

    private void GetNewsInfo()
    {
        string sql = "select Title,Content,CreateDate,ComeFrom from Whir_U_News where Whir_U_News_PID=" + _Id;
        DataTable dt = Whir.SQLServerDAL.DbHelperSQL.Query(sql).Tables[0];
        if (dt != null && dt.Rows.Count > 0)
        {
            ltrTitle.Text = dt.Rows[0]["Title"].ToString();
            ltrContent.Text = dt.Rows[0]["Content"].ToString();

            //string url=HttpContext.Current.Request.RawUrl;
            string url = string.Format("news_info.aspx?id={0}&mode={1}&cid={2}&parendId={3}",_Id, mode,_cid,parentId);
            ltrContent.Text = ContentPage.content(dt.Rows[0]["Content"].ToString(), url);

            ltrCreateDate.Text = dt.Rows[0]["CreateDate"].ToString();
            ltrComeFrom.Text = dt.Rows[0]["ComeFrom"].ToString();

        }
    }

    

  


    
}
